<template>
  <div class="page-container">
    <el-card shadow="never" class="search-form-card">
      <el-form class="search-form" inline label-width="75px" label-suffix=":">
        <el-row :gutter="50">
          <el-col :span="8">
            <el-form-item label="审核类型">
              <el-select v-model="searchParams.type" placeholder="请选择">
                <el-option
                  v-for="item in statusOptions"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="提交部门">
              <el-select v-model="searchParams.dep" placeholder="请选择">
                <el-option
                  v-for="item in statusOptions"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="状态">
              <el-select v-model="searchParams.status" placeholder="请选择">
                <el-option
                  v-for="item in statusOptions"
                  :key="item.id"
                  :label="item.name"
                  :value="item.id"
                />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="服务名称">
              <el-input v-model="searchParams.name" placeholder="请输入关键字" />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item>
              <el-button type="primary">查询</el-button>
              <el-button>重置</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <el-card shadow="never">
      <el-tabs v-model="activeName">
        <el-tab-pane label="发布审核" name="publish" />
        <el-tab-pane label="订阅审核" name="subscribe" />
        <div class="table-box">
          <el-table
            v-loading="loading"
            stripe
            :data="tableData"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(255, 255, 255, 0.8)"
            @selection-change="onSelect"
          >
            <el-table-column type="selection" width="50px" />
            <el-table-column
              v-for="item in columns"
              :key="item.prop"
              :prop="item.prop"
              :label="item.label"
              align="center"
            />
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                  type="text"
                  @click="dialogEdit(scope.row)"
                >查看详情</el-button>
                <el-button
                  type="text"
                  color="#0DB493"
                  @click="handleAudit(scope.row)"
                >立即审核</el-button>
              </template>
            </el-table-column>

          </el-table>
        </div>
        <div class="page-box">
          <el-pagination
            background
            :current-page="pageNo"
            :page-sizes="pageSizes"
            :page-size="pageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="totalSize"
            @size-change="changePageSize"
            @current-change="changePageNo"
          />
        </div>
      </el-tabs>
    </el-card>
    <PublishToolForm ref="PublishToolForm" title="数据应用审核" />
    <SubscribeToolForm ref="SubscribeToolForm" title="数据应用订阅审核" />
  </div>
</template>

<script>
import PublishToolForm from '@/views/serve-audit/application/publish-audit-form/toolForm'
import SubscribeToolForm from '@/views/serve-audit/application/subscribe-audit-form/toolForm'
import crud from '@/mixins/crud'
export default {
  components: {
    PublishToolForm,
    SubscribeToolForm
  },
  mixins: [crud],
  data() {
    return {
      activeName: 'publish',
      searchParams: {
        date: [],
        status: ''
      },
      statusOptions: [
        {
          id: '1',
          name: '1'
        }
      ],
      columns: [
        { prop: '服务名称', label: '服务名称', width: '', minWidth: '' },
        { prop: '审核类型', label: '审核类型', width: '', minWidth: '' },
        { prop: '提交审核时间', label: '提交审核时间', width: '', minWidth: '' },
        { prop: '提交部门', label: '提交部门', width: '', minWidth: '' },
        { prop: '状态', label: '状态', width: '', minWidth: '' }
      ],
      tableData: [
        {
          服务名称: '服务名称'
        }
      ]
    }
  },
  methods: {
    dialogDetail() {

    },
    handleAudit() {
      if (this.activeName === 'publish') {
        this.$refs.PublishToolForm.open()
      } else {
        this.$refs.SubscribeToolForm.open()
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.page-container {
  height: 100%;
}
</style>
